home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Controls / Visual Basic Controls.iso / vbcontrol / sregexpf / sgregexp.cpp < prev    next >
C/C++ Source or Header  |  1998-06-01  |  2KB  |  72 lines

  1.  
  2. // Note: Proxy/Stub Information
  3. //        To build a separate proxy/stub DLL, 
  4. //        run nmake -f RegExpps.mk in the project directory.
  5.  
  6. #include "stdafx.h"
  7. #include "resource.h"
  8. #include "initguid.h"
  9. #include "sgRegExp.h"
  10.  
  11. #include "sgRegExp_i.c"
  12. #include "RegExp.h"
  13.  
  14.  
  15. CComModule _Module;
  16.  
  17. BEGIN_OBJECT_MAP(ObjectMap)
  18.     OBJECT_ENTRY(CLSID_RegExp, sgRegExp)
  19. END_OBJECT_MAP()
  20.  
  21. /////////////////////////////////////////////////////////////////////////////
  22. // DLL Entry Point
  23.  
  24. extern "C"
  25. BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
  26. {
  27.     if (dwReason == DLL_PROCESS_ATTACH)
  28.     {
  29.         _Module.Init(ObjectMap, hInstance);
  30.         DisableThreadLibraryCalls(hInstance);
  31.     }
  32.     else if (dwReason == DLL_PROCESS_DETACH)
  33.         _Module.Term();
  34.     return TRUE;    // ok
  35. }
  36.  
  37. /////////////////////////////////////////////////////////////////////////////
  38. // Used to determine whether the DLL can be unloaded by OLE
  39.  
  40. STDAPI DllCanUnloadNow(void)
  41. {
  42.     return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
  43. }
  44.  
  45. /////////////////////////////////////////////////////////////////////////////
  46. // Returns a class factory to create an object of the requested type
  47.  
  48. STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
  49. {
  50.     return _Module.GetClassObject(rclsid, riid, ppv);
  51. }
  52.  
  53. /////////////////////////////////////////////////////////////////////////////
  54. // DllRegisterServer - Adds entries to the system registry
  55.  
  56. STDAPI DllRegisterServer(void)
  57. {
  58.     // registers object, typelib and all interfaces in typelib
  59.     return _Module.RegisterServer(TRUE);
  60. }
  61.  
  62. /////////////////////////////////////////////////////////////////////////////
  63. // DllUnregisterServer - Removes entries from the system registry
  64.  
  65. STDAPI DllUnregisterServer(void)
  66. {
  67.     _Module.UnregisterServer();
  68.     return S_OK;
  69. }
  70.  
  71.  
  72.